'use strict';
console.log(123);
console.log(123.13);
console.log(Infinity);
console.log(NaN);

console.log("----------字符串------------");
console.log("NaN");
console.log("\\NaN");
console.log(`ab
cb`);
let name = "xiaobai";
let age = 4;
console.log(`hello ${name}, I am ${age} years old.`);
console.log(name.length);
console.log(name[2]);
console.log(name.toUpperCase());
console.log(name.indexOf("l"));
console.log(name.substring(1, 3)); //[1, 3)

console.log("----------bool------------");
console.log(true);
console.log(false);

// == 不带类型等于
// === 带类型等于(尽量使用这种比较)
// NaN六亲不认 isNaN()判断一个数是否是NaN

// null 空
// undefined 未定义
console.log(null);
console.log(undefined);


console.log("----------数组------------");
// 索引越界 undefined
let arr = [1, "123", null, true, undefined];
arr.forEach(function (i) {
    console.log(i);
});
for (let element of arr) {
    console.log(element);
}
console.log(arr.length);
console.log(arr.length);
console.log(arr.indexOf(null));
console.log(arr.slice(1, 3));   //[1, 3)
arr.push("footer");
console.log(arr);
arr.pop();
console.log(arr);
arr.unshift("header");
console.log(arr);
arr.shift();
console.log(arr);
arr = ["b", "c", "a", "d"];
arr.sort();
console.log(arr);
arr.reverse();
console.log(arr);
console.log(arr.concat("1", "2", "3")); // concat不改变原数组, 返回一个新的数组
console.log(arr.join(","));


// 对象
console.log("----------对象------------");
let person = {
    name: "xiaobai",
    age: 3,
    tag: ["Java", "Kotlin", "Js", "Python"],
    hello: function () {
        console.log(person[name]);
        console.log(person.age);
        console.log(person.tag);
    }
};
person.hello();
// 动态添加和删除属性
delete person.tag;
console.log(person);
person.xx = "123";
console.log(person);
// 判断属性是否存在, 可以继承父类
console.log("xx" in person);
// 不可继承父类
console.log(person.hasOwnProperty("xx"));


console.log("----------Map------------");
let map = {

};